unit uSlownikPM;

interface



uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Buttons, StdCtrls, listlink, Db, ADODB;
  
type
  TFAktywniPM = class(TForm)
    ListLink1: TListLink;
    ListBox1: TListBox;
    Label1: TLabel;
    ListBox2: TListBox;
    Label2: TLabel;
    Button1: TButton;
    Button3: TButton;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    qTemp: TADOQuery;
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    BazaDyn : string;    
  end;

var
  FAktywniPM: TFAktywniPM;

implementation

{$R *.DFM}

uses Wilk;

procedure TFAktywniPM.FormShow(Sender: TObject);
begin
  SQLOpen(qTemp, 'SELECT PM FROM MBA..TW_wPM with (NOLOCK) '+
                 ' WHERE PM NOT IN (SELECT Opis FROM '+BazaDyn+'..tw_Slownik with (NOLOCK) WHERE Kod=100) '+
                 ' ORDER BY PM ');
  ListBox1.Items.Clear;
  while not qTemp.EOF do
  begin
    if Trim(qTemp.Fields[0].AsString)<> '' then
      ListBox1.Items.Add(qTemp.Fields[0].AsString);
    qTemp.Next;
  end;
  SQLOpen(qTemp, 'SELECT Opis FROM '+BazaDyn+'..tw_Slownik with (NOLOCK) WHERE Kod=100 '+
                 ' ORDER BY Opis ');
  ListBox2.Items.Clear;
  while not qTemp.EOF do
  begin
    if Trim(qTemp.Fields[0].AsString)<> '' then
      ListBox2.Items.Add(qTemp.Fields[0].AsString);
    qTemp.Next;
  end;
end;

end.
